package com.shakev.collect.tk.service.impl;

import com.shakev.collect.tk.service.TaobaoService;
import com.taobao.api.ApiException;
import com.taobao.api.DefaultTaobaoClient;
import com.taobao.api.TaobaoClient;
import com.taobao.api.request.TbkDgItemCouponGetRequest;
import com.taobao.api.request.TbkItemGetRequest;
import com.taobao.api.request.TbkItemInfoGetRequest;
import com.taobao.api.response.TbkDgItemCouponGetResponse;
import com.taobao.api.response.TbkItemInfoGetResponse;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName TaobaoServiceImpl
 * @Description TODO
 * @Author 李伟松
 * @CreateDate 2019-05-07 下午 10:26
 * @UpdateDate 2019-05-07 下午 10:26
 * @Version 1.0
 */
@Service
public class TaobaoServiceImpl implements TaobaoService {


    public static void main(String[] args) throws ApiException {
        TaobaoClient client = new DefaultTaobaoClient("http://gw.api.taobao.com/router/rest", "26047170", "c006dc9eb64e651a6a51243583d2ae93");

        TbkDgItemCouponGetRequest req = new TbkDgItemCouponGetRequest();

        req.setAdzoneId(67776250488L);
        req.setPlatform(1L);
        req.setCat("16");
        req.setPageSize(1L);
        req.setQ("女装");
        req.setPageNo(1L);
        TbkDgItemCouponGetResponse rsp = client.execute(req);
        List<TbkDgItemCouponGetResponse.TbkCoupon> res = rsp.getResults();
        for (TbkDgItemCouponGetResponse.TbkCoupon re : res) {

        }
        System.out.println(rsp.getBody());


    }



}
